//
//  ccHomeViewController.m
//  CloudCat
//
//  Created by Xiaomin Cai on 4/9/12.
//  Copyright (c) 2012 Taobao. All rights reserved.
//

#import "ccHomeViewController.h"

@interface ccHomeViewController ()

@end

@implementation ccHomeViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = YES;
    // Do any additional setup after loading the view from its nib.
    self.title = @"首页";
    CGRect applicationFrame = [UIScreen mainScreen].applicationFrame;
	
    self.view = [[[UIView alloc] initWithFrame:applicationFrame] autorelease];
    self.view.backgroundColor = TTSTYLEVAR(tabTintColor);
    
    _tabBar1 = [[TTTabStrip alloc] initWithFrame:CGRectMake(0, 0, applicationFrame.size.width, 41)];
    _tabBar1.tabItems = [NSArray arrayWithObjects:
                         [[[TTTabItem alloc] initWithTitle:@"Item 1"] autorelease],
                         [[[TTTabItem alloc] initWithTitle:@"Item 2"] autorelease],
                         [[[TTTabItem alloc] initWithTitle:@"Item 3"] autorelease],
                         [[[TTTabItem alloc] initWithTitle:@"Item 4"] autorelease],
                         [[[TTTabItem alloc] initWithTitle:@"Item 5"] autorelease],
                         [[[TTTabItem alloc] initWithTitle:@"Item 6"] autorelease],
                         [[[TTTabItem alloc] initWithTitle:@"Item 7"] autorelease],
                         [[[TTTabItem alloc] initWithTitle:@"Item 8"] autorelease],
                         [[[TTTabItem alloc] initWithTitle:@"Item 9"] autorelease],
                         [[[TTTabItem alloc] initWithTitle:@"Item 10"] autorelease],
                         nil];
    
    [self.view addSubview:_tabBar1];
    _tabBar1.delegate = self;
    controller = [[ccHomeSubViewController1 alloc] initWithNibName:@"ccHomeSubViewController1" bundle:nil];
    [self.view addSubview:controller.view];
    [self.view bringSubviewToFront:_tabBar1];
//    _tabController = [[UITabBarController alloc] init];
//    [_tabController setTabURLs:[NSArray arrayWithObjects:@"tt://home/1",
//                                @"tt://home/2",
//                                @"tt://home/3",
//                                @"tt://home/4",
//                                @"tt://home/5",
//                                nil]];
//    [self.view addSubview:_tabController.view];
}
- (void)tabBar:(TTTabBar*)tabBar tabSelected:(NSInteger)selectedIndex;
{
    [controller setPage:selectedIndex+1];
//    [[TTNavigator navigator] openURLAction:[TTURLAction actionWithURLPath:[NSString stringWithFormat:@"tt://home/%d",selectedIndex]]];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
